package com.heima.controller;


import cn.hutool.core.bean.BeanUtil;
import com.heima.pojo.Role;
import com.heima.pojo.vo.RoleVo;
import com.heima.service.IRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 用户角色表 前端控制器
 * </p>
 *
 * @author xjy
 * @since 2024-06-06
 */
@RestController
@RequestMapping("/user-service/role")
@Api(tags = "角色管理")
public class RoleController {
    @Autowired
    private IRoleService roleService;

    @GetMapping
    @ApiOperation("查询角色列表")
    public List<RoleVo> search() {
        List<Role> list = roleService.list();
        return BeanUtil.copyToList(list, RoleVo.class);
    }

}
